package scuts.smacro;

import haxe.macro.Context;
import haxe.macro.Expr;
import scuts.macro.Convert;
import scuts.smacro.Builder;
import utest.Assert;

class MacroBuilder_HelperFunctions_Test
{

  public function new() {}
  
  public function test_isAllowedTypeDecl () 
  {
    var t = Convert.stringToComplexType("Array<Expr>");
    
    var r = Builder.isAllowedTypeDecl(t);
    Assert.isTrue(r.valid && r.hasExprs);
  }
  
  public function test_isAllowedTypeDecl2 () 
  {
    var t = Convert.stringToComplexType("Array<{a:Expr, b:Expr}>");
    var r = Builder.isAllowedTypeDecl(t);
    Assert.isTrue(r.valid && r.hasExprs);
  }
  
  public function test_isAllowedTypeDecl_NoExprs () 
  {
    var t = Convert.stringToComplexType("Array<Int>");
    var r = Builder.isAllowedTypeDecl(t);
    Assert.isTrue(r.valid && !r.hasExprs);
  }
  
  
}
